package com.ruoyi.cmemetal.controller;

import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.cmemetal.domain.ZxPrintProcess;
import com.ruoyi.cmemetal.service.IZxPrintProcessService;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;

/**
 * PrintProcessController
 *
 * @author zhangxu
 * @date 2021-12-30
 */
@RestController
@RequestMapping("/PrintProcess/PrintProcess")
public class ZxPrintProcessController extends BaseController
{
    @Autowired
    private IZxPrintProcessService zxPrintProcessService;

    /**
     * 查询PrintProcess列表
     */
    @PreAuthorize("@ss.hasPermi('PrintProcess:PrintProcess:list')")
    @GetMapping("/list")
    public TableDataInfo list(ZxPrintProcess zxPrintProcess)
    {
        startPage();
        List<ZxPrintProcess> list = zxPrintProcessService.selectZxPrintProcessList(zxPrintProcess);
        return getDataTable(list);
    }

    /**
     * 导出PrintProcess列表
     */
    @PreAuthorize("@ss.hasPermi('PrintProcess:PrintProcess:export')")
    @Log(title = "PrintProcess", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, ZxPrintProcess zxPrintProcess)
    {
        List<ZxPrintProcess> list = zxPrintProcessService.selectZxPrintProcessList(zxPrintProcess);
        ExcelUtil<ZxPrintProcess> util = new ExcelUtil<ZxPrintProcess>(ZxPrintProcess.class);
        util.exportExcel(response, list, "PrintProcess数据");
    }

    /**
     * 获取PrintProcess详细信息
     */
    @PreAuthorize("@ss.hasPermi('PrintProcess:PrintProcess:query')")
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") Long id)
    {
        return AjaxResult.success(zxPrintProcessService.selectZxPrintProcessById(id));
    }

    /**
     * 新增PrintProcess
     */
    @PreAuthorize("@ss.hasPermi('PrintProcess:PrintProcess:add')")
    @Log(title = "PrintProcess", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody ZxPrintProcess zxPrintProcess)
    {
        return toAjax(zxPrintProcessService.insertZxPrintProcess(zxPrintProcess));
    }

    /**
     * 修改PrintProcess
     */
    @PreAuthorize("@ss.hasPermi('PrintProcess:PrintProcess:edit')")
    @Log(title = "PrintProcess", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody ZxPrintProcess zxPrintProcess)
    {
        return toAjax(zxPrintProcessService.updateZxPrintProcess(zxPrintProcess));
    }

    /**
     * 删除PrintProcess
     */
    @PreAuthorize("@ss.hasPermi('PrintProcess:PrintProcess:remove')")
    @Log(title = "PrintProcess", businessType = BusinessType.DELETE)
	@DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable Long[] ids)
    {
        return toAjax(zxPrintProcessService.deleteZxPrintProcessByIds(ids));
    }
}
